package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 动态实体类
 * 对应数据库表：dynamic
 * 
 * @author system
 */
@Table(name = "dynamic")
public class Dynamic implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 动态ID
     */
    @Column(name = "dynamic_id")
    private String dynamicId;

    /**
     * 发布者ID
     */
    @Column(name = "uid")
    private String uid;

    /**
     * 发布者昵称
     */
    @Column(name = "uname")
    private String uname;

    /**
     * 用户头像
     */
    @Column(name = "avatar_url")
    private String avatarUrl;

    /**
     * 动态内容
     */
    @Column(name = "dynamic_content")
    private String dynamicContent;

    /**
     * 图片路径
     */
    @Column(name = "img_urls")
    private String imgUrls;

    /**
     * 动态类型ID
     */
    @Column(name = "dynamic_type_id")
    private Integer dynamicTypeId;

    /**
     * 发布日期
     */
    @Column(name = "publish_date")
    private Date publishDate;

    /**
     * 音乐ID
     */
    @Column(name = "music_id")
    private String musicId;

    /**
     * 浏览次数
     */
    @Column(name = "view_count")
    private Long viewCount;

    /**
     * 举报次数
     */
    @Column(name = "report_count")
    private String reportCount;

    /**
     * 状态
     */
    @Column(name = "status")
    private String status;

    /**
     * 最新评论时间
     */
    @Column(name = "recentCommentDate")
    private Date recentCommentDate;

    // 构造方法
    public Dynamic() {
    }

    public Dynamic(String dynamicId, String uid, String uname, String dynamicContent) {
        this.dynamicId = dynamicId;
        this.uid = uid;
        this.uname = uname;
        this.dynamicContent = dynamicContent;
        this.publishDate = new Date();
        this.viewCount = 0L;
        this.status = "1";
    }

    // Getter 和 Setter 方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDynamicId() {
        return dynamicId;
    }

    public void setDynamicId(String dynamicId) {
        this.dynamicId = dynamicId;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getDynamicContent() {
        return dynamicContent;
    }

    public void setDynamicContent(String dynamicContent) {
        this.dynamicContent = dynamicContent;
    }

    public String getImgUrls() {
        return imgUrls;
    }

    public void setImgUrls(String imgUrls) {
        this.imgUrls = imgUrls;
    }

    public Integer getDynamicTypeId() {
        return dynamicTypeId;
    }

    public void setDynamicTypeId(Integer dynamicTypeId) {
        this.dynamicTypeId = dynamicTypeId;
    }

    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    public String getMusicId() {
        return musicId;
    }

    public void setMusicId(String musicId) {
        this.musicId = musicId;
    }

    public Long getViewCount() {
        return viewCount;
    }

    public void setViewCount(Long viewCount) {
        this.viewCount = viewCount;
    }

    public String getReportCount() {
        return reportCount;
    }

    public void setReportCount(String reportCount) {
        this.reportCount = reportCount;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getRecentCommentDate() {
        return recentCommentDate;
    }

    public void setRecentCommentDate(Date recentCommentDate) {
        this.recentCommentDate = recentCommentDate;
    }

    @Override
    public String toString() {
        return "Dynamic{" +
                "id=" + id +
                ", dynamicId='" + dynamicId + '\'' +
                ", uid='" + uid + '\'' +
                ", uname='" + uname + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                ", dynamicContent='" + dynamicContent + '\'' +
                ", imgUrls='" + imgUrls + '\'' +
                ", dynamicTypeId=" + dynamicTypeId +
                ", publishDate=" + publishDate +
                ", musicId='" + musicId + '\'' +
                ", viewCount=" + viewCount +
                ", reportCount='" + reportCount + '\'' +
                ", status='" + status + '\'' +
                ", recentCommentDate=" + recentCommentDate +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        Dynamic dynamic = (Dynamic) o;

        return dynamicId != null ? dynamicId.equals(dynamic.dynamicId) : dynamic.dynamicId == null;
    }

    @Override
    public int hashCode() {
        return dynamicId != null ? dynamicId.hashCode() : 0;
    }
}